﻿using System;

namespace _09.MostFrequentNumberInArray
{
    class Program
    {
        static void Main()
        {
            Console.Write("Enter lenght of array N=");
            int N = int.Parse(Console.ReadLine());
            int[] arr = new int[N];
            Console.WriteLine("Enter elements of array.The elements must be integer numbers.");
            for (int i = 0; i < N; i++)
            {
                arr[i] = int.Parse(Console.ReadLine());
            }
            Array.Sort(arr);
            int count = 1;
            int index = 0;
            int maxCount = 0;
            for (int i = 0; i < N-1; i++)
            {
                if (arr[i]==arr[i+1])
                {
                    count++;
                    index = i;
                }
                else
                {
                    count = 1;
                }
                if (count>maxCount)
                {
                    maxCount = count;
                    index = i;
                }       
            }
            Console.WriteLine(arr[index]+","+maxCount);
        }
    }
}
